package com.hw.paltfrom.controller.system;

import java.util.List;

/**
 *角色角色关系绑定
 * 曹荣坤
 * 2019年11月6日15:06:04
 */

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hw.paltfrom.pack.ResponseResult;
import com.hw.paltfrom.rescode.HWSystemCode;
import com.hw.paltfrom.service.system.BaseUserRelationServer;
import com.hw.paltfrom.utils.VerifyUtil;
import com.hw.paltfrom.vo.BaseUserRelationListVo;
import com.hw.paltfrom.vo.BaseUserRelationVo;

@RestController
@RequestMapping(value = "/BaseUserRelation")
public class BaseUserRelationController {
	
	@Autowired
	private BaseUserRelationServer baseUserRelationServer;
	
	@RequestMapping(value = "/insert")
	public Map<String, Object> Query(@RequestBody BaseUserRelationListVo vo) {
		List<BaseUserRelationVo> voList = vo.getVoList();
		String roleid = vo.getfRoleid();
		if (voList.isEmpty()) {
			return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
		}
		return baseUserRelationServer.insert(voList,roleid);
	}

	@RequestMapping(value = "/query")
	public Map<String, Object> Query(BaseUserRelationVo vo) {
		Boolean flag = VerifyUtil.verifyParams(vo);
		if (!flag) {
			return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
		}
		return baseUserRelationServer.queryAllList(vo);
	}
	
	@RequestMapping(value = "/removeUser")
	public Map<String, Object> removeUser(@RequestBody BaseUserRelationListVo vo) {
		List<BaseUserRelationVo> voList = vo.getVoList();
		if (voList.isEmpty()) {
			return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
		}
		return baseUserRelationServer.removeUser(voList);
	}
	//查询当前县的流动稽查人员信息
	@RequestMapping(value = "/queryUser")
	public Map<String, Object> queryUser(BaseUserRelationVo vo) {
		
		return baseUserRelationServer.queryUser(vo);
	}
}
